package com.hctforgreen.greenservice.model;

import org.json.JSONException;
import org.json.JSONObject;

public class UserInfoEntity extends BaseEntity {
	private static final long serialVersionUID = 1763969765820367713L;

	public String state = "";
	public String userId = "";
	public String userName = "";
	public String userDepart = "";
	public String userAut = "";
	public final static String STATE = "state";
	private final static String BODY = "body";
	private final static String USER_ID = "userId";
	private final static String USER_NAME = "userName";
	private final static String USER_DEPART = "userDepart";
	private final static String USER_AUT = "userAut";
	public static UserInfoEntity parse(JSONObject jsonObject)
			throws JSONException {
		UserInfoEntity bean = new UserInfoEntity();
		if (jsonObject.has(STATE)) {
			bean.state = jsonObject.getString(STATE);
		}
		/**
		 * 解析data节点
		 */
		if (jsonObject.has(BODY)) {

			JSONObject bodyObject = jsonObject.getJSONObject(BODY);

			if (bodyObject.has(USER_ID)) {
				bean.userId = bodyObject.getString(USER_ID);
			}

			if (bodyObject.has(USER_NAME)) {
				bean.userName = bodyObject.getString(USER_NAME);
			}
			if (bodyObject.has(USER_DEPART)) {
				bean.userDepart = bodyObject.getString(USER_DEPART);
			}
			if (bodyObject.has(USER_AUT)) {
				bean.userAut = bodyObject.getString(USER_AUT);
			}
			
		}
		return bean;
	}

	
}
